<%@ page contentType="text/html; charset=utf-8" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<!DOCTYPE html>
<html lang="zh">
<head>
    <title>后台管理 - 爱购物-商城</title>
    <link type="text/css" rel="stylesheet" href="${pageContext.request.contextPath}/static/css/style.css"/>
    <style>
        .manage .form td.field {
            width: 70px;
        }
    </style>
</head>
<body>
<c:import url="/static/page/manager-header-nav.jsp">
    <c:param name="nav" value="news"/>
</c:import>
<div id="position" class="wrap">
    您现在的位置：<a href="${pageContext.request.contextPath}/index">爱购物-商城</a> &gt; 管理后台
</div>
<div id="main" class="wrap clearfix">
    <c:import url="/static/page/manage-left-nav.jsp"/>
    <div class="main">
        <h2>修改新闻</h2>
        <div class="manage">
            <form action="" method="post" onsubmit="return checkForm()">
                <table class="form">
                    <input type="hidden" name="id" value="${news.id}" />
                    <tr>
                        <td class="field"><label for="title">新闻标题：</label></td>
                        <td><input type="text" class="text" name="title" id="title" value="${news.title}" style="width: 590px;" /></td>
                    </tr>
                    <tr>
                        <td class="field"><label for="content">新闻内容：</label></td>
                        <td><textarea id="content" name="content">${news.content}</textarea></td>
                    </tr>
                    <tr>
                        <td></td>
                        <td><label class="ui-blue"><input type="submit" value="修改" /></label></td>
                    </tr>
                </table>
            </form>
        </div>
    </div>
</div>
<c:import url="/static/page/footer.jsp"/>
<script type="text/javascript" src="${pageContext.request.contextPath}/static/HandyEditor/HandyEditor.min.js"></script>
<script>
    // 初始化富文本编辑器
    let he = HE.getEditor('content',{
        width: '600px',
        item : ['bold','italic','strike','underline','fontSize','fontName','paragraph','color','backColor','|','left','center','right','full','indent','outdent','|','link','unlink','textBlock','code','removeFormat','trash']
    });
    // 将textarea中的值渲染到富文本编辑器中
    he.show();
    function checkForm() {
        // 将富文本编辑内容同步到textarea
        he.sync();
        return true;
    }
</script>
</body>
</html>
